#include "opencv2/imgcodecs.hpp"
#include <iostream>
int main(){
    cv::Mat mat(480, 640, CV_8UC3, cv::Scalar(0,255,255));
    std::vector<int> compression_params;
    compression_params.push_back(cv::IMWRITE_PNG_COMPRESSION);
    compression_params.push_back(9);
    bool result = false;
    try{
        result = imwrite("alpha.png", mat, compression_params);
        if (result){
            std::cout<<"Image saved successfully!"<<std::endl;
        }
        else{
            std::cout<<"Failed to save image."<<std::endl;
        }
    }
    catch(const cv::Exception& ex){
        fprintf(stderr,"Exception converting image to PNG format: %s\n",ex.what()) ;
    }
    return 0;
}